home *** CD-ROM | disk | FTP | other *** search
/ The Utilities Experience / The Utilities Experience - Volume 1.iso / software / demos / e-q / mand2000demo / arexx / demo.mnd2 < prev    next >
Text File  |  1978-06-29  |  11KB  |  302 lines

  1. /* This script is supplied with the Mand2000 demo and release */
  2. /* versions and may be freely distributed. */
  3. /* Copyright 1993 Cygnus Software. */
  4.  
  5. /* An ARexx script for imitating the Demo Mode of the earlier */
  6. /* versions of Mand2000.  This script zooms in (with pauses for */
  7. /* calculations) towards various beautiful locations specified */
  8. /* in the script.  When it reaches them it resets and zooms towards */
  9. /* another location. */
  10.  
  11. /*
  12.     By   duplicating   or   removing  some  code  at  the  end  of
  13. ContinueDemo:   you can adjust how many zooms Mand2000 does per stage.
  14. If  you set it to do just one zoom then the demo runs rather tediously
  15. slow.
  16.  
  17.     If you don't want the status window you should comment out the
  18. DisplayMessage lines at the end of NewLocation and ContinueDemo.
  19.     */
  20.  
  21. portname = address()    /* Retrieve the current port name. */
  22. /* If the portname does not start with MAND2000 then this script must */
  23. /* have been run with rx, rather than from Mand2000.  Therefore we */
  24. /* need to set the port name.  We do not always set the port name */
  25. /* because it is better to let Mand2000 set it for us, so that */
  26. /* this script can be used with windows other than the one with */
  27. /* port name MAND2000.1. */
  28. if (left(portname, 8) ~= "MAND2000") THEN
  29.     address 'MAND2000.1'
  30.  
  31. options results
  32.  
  33. /*
  34.     The  following code sets up the coordinates of the pictures to
  35. zoom  towards  when  running  the  demo.   The format should be fairly
  36. obvious  from  the  examples below.  IMPORTANT:  before adding any new
  37. locations, or making any other changes to this file, be sure to make a
  38. backup  copy, as it is very easy to make syntax errors which will make
  39. this script stop working.
  40.  
  41.     The  name  of  the location must be enclosed in quotes.  The X
  42. and  Y  coordinates  are  the coordinates of the center of the spot to
  43. zoom  towards.   Zooms  is the number of zooms to do before going onto
  44. the  next  picture.   Type  is the fractal type.  Usually this will be
  45. 'Mandelbrot'  or  'Mandelbrot  Julia'.   If you specify Julia then you
  46. should also specify JuliaReal and JuliaImaginary (see Julia Boot as an
  47. example)  as  these  specify the Julia's seed location.  If you have a
  48. math  coprocessor  (68881,  68882  or  68040)  then  you also have the
  49. MandCubed  and  MandFourth  fractal  types, and their associated julia
  50. sets  -  see  the  help  on set location for details.  Optionally, for
  51. those  areas that require it, you can specify that the location should
  52. have  a  higher than normal Max Iterations, by setting ExtraIterations
  53. to  the  number  of iterations beyond the normal for the pictures zoom
  54. level, that you would like.  See the example.
  55.  
  56.     It  is very important when entering new numbers to ensure that
  57. your  numbers  are  correct - no spaces or commas allowed in numbers -
  58. and  that  the index number is the same for all the lines describing a
  59. particular location.  The index number is the number immediately after
  60. 'Pictures'.  It is also very important to enclose the location numbers
  61. in quotes, as in the examples below.  If you don't then ARexx will try
  62. to  interpret  the  numbers.   Usually  this  is okay, but many of the
  63. numbers  have more digits of accuracy than ARexx can handle, and these
  64. extra digits will get lost without the quoting.
  65.  
  66.     It is also important that the final entry have a zoom count of
  67. zero so that the code will no when to return to the first entry.
  68.  
  69.     Currently  this  script  is set up so that if you run it, then
  70. stop,  then  run  it  again,  it  will  resume on the same picture you
  71. stopped  on  (although  not  the  same zoom level).  If this behaviour
  72. causes  problems, or if this script encounters an error and ends up in
  73. an  undefined  state,  comment  out  the  line  below  which  says 'if
  74. (DemoPictureNum   =  "")  THEN'  by  enclosing  it  in  ARexx  comment
  75. delimiters,  like  this '/* if (DemoPictureNum = "") */'.  Do not type
  76. the  quotes.   The  line  is  clearly  marked and is shortly after the
  77. StartDemo:  label.
  78.  
  79.     If you run this script several times in a row without stopping
  80. it,  you  will  end  up with multiple 'Stop Demo' entries in your user
  81. menu.   These can be removed by repeatedly selecting 'Stop Demo' until
  82. they are all gone.
  83.  
  84.     If  for  some  reason  you  can  not  get  this script to stop
  85. running,  you  may  need to exit Mand2000.  This should only happen if
  86. there is a bug in the ARexx script.
  87.  
  88.     For  more  information,  consult  your  ARexx  manual  or  the
  89. Mand2000 ARexx documentation.
  90.     */
  91.  
  92. DemoPictureNum = 0
  93.  
  94. Pictures.DemoPictureNum.Name = "Julia Boot"
  95. Pictures.DemoPictureNum.X = "0"
  96. Pictures.DemoPictureNum.Y = "0"
  97. Pictures.DemoPictureNum.JuliaReal = "0.329"
  98. Pictures.DemoPictureNum.JuliaImaginary = "0.041"
  99. Pictures.DemoPictureNum.Zooms = 4
  100. Pictures.DemoPictureNum.Type = "Mandelbrot JULIA"
  101. Pictures.DemoPictureNum.ExtraIterations = 0
  102. DemoPictureNum = DemoPictureNum + 1
  103.  
  104. Pictures.DemoPictureNum.Name = "Dragon"
  105. Pictures.DemoPictureNum.X = "-1.25269"
  106. Pictures.DemoPictureNum.Y = "-0.04164"
  107. Pictures.DemoPictureNum.Zooms = 12
  108. Pictures.DemoPictureNum.Type = "Mandelbrot"
  109. Pictures.DemoPictureNum.ExtraIterations = 0
  110. DemoPictureNum = DemoPictureNum + 1
  111.  
  112. Pictures.DemoPictureNum.Name = "Off axis filaments"
  113. Pictures.DemoPictureNum.X = "-1.74910040"
  114. Pictures.DemoPictureNum.Y = "-0.00034817"
  115. Pictures.DemoPictureNum.Zooms = 25
  116. Pictures.DemoPictureNum.Type = "Mandelbrot"
  117. Pictures.DemoPictureNum.ExtraIterations = 0
  118. DemoPictureNum = DemoPictureNum + 1
  119.  
  120. Pictures.DemoPictureNum.Name = "Six arms"
  121. Pictures.DemoPictureNum.X = "-.8627"
  122. Pictures.DemoPictureNum.Y = "0.2648"
  123. Pictures.DemoPictureNum.Zooms = 10
  124. Pictures.DemoPictureNum.Type = "Mandelbrot"
  125. Pictures.DemoPictureNum.ExtraIterations = 0
  126. DemoPictureNum = DemoPictureNum + 1
  127.  
  128. Pictures.DemoPictureNum.Name = "Nautilus"
  129. Pictures.DemoPictureNum.X = "-1.98540769643288"
  130. Pictures.DemoPictureNum.Y =  "0.00000000000470"
  131. Pictures.DemoPictureNum.Zooms = 38
  132. Pictures.DemoPictureNum.Type = "Mandelbrot"
  133. Pictures.DemoPictureNum.ExtraIterations = 0
  134. DemoPictureNum = DemoPictureNum + 1
  135.  
  136. Pictures.DemoPictureNum.Name = "Paisley"
  137. Pictures.DemoPictureNum.X = "0.306594"
  138. Pictures.DemoPictureNum.Y = "0.023627"
  139. Pictures.DemoPictureNum.Zooms = 10
  140. Pictures.DemoPictureNum.Type = "Mandelbrot"
  141. Pictures.DemoPictureNum.ExtraIterations = 0
  142. DemoPictureNum = DemoPictureNum + 1
  143.  
  144. Pictures.DemoPictureNum.Name = "Twelve arms"
  145. Pictures.DemoPictureNum.X = "-.7764"
  146. Pictures.DemoPictureNum.Y = "0.1346"
  147. Pictures.DemoPictureNum.Zooms = 12
  148. Pictures.DemoPictureNum.Type = "Mandelbrot"
  149. Pictures.DemoPictureNum.ExtraIterations = 0
  150. DemoPictureNum = DemoPictureNum + 1
  151.  
  152. Pictures.DemoPictureNum.Name = "Russian circles"
  153. Pictures.DemoPictureNum.X = "-1.98540769644835784"
  154. Pictures.DemoPictureNum.Y =  "0.0"
  155. Pictures.DemoPictureNum.Zooms = 50
  156. Pictures.DemoPictureNum.Type = "Mandelbrot"
  157. Pictures.DemoPictureNum.ExtraIterations = 0
  158. DemoPictureNum = DemoPictureNum + 1
  159.  
  160. Pictures.DemoPictureNum.Name = "Spiral Galaxy"
  161. Pictures.DemoPictureNum.X = "-0.7782"
  162. Pictures.DemoPictureNum.Y =  "0.13504"
  163. Pictures.DemoPictureNum.Zooms = 10
  164. Pictures.DemoPictureNum.Type = "Mandelbrot"
  165. Pictures.DemoPictureNum.ExtraIterations = 0
  166. DemoPictureNum = DemoPictureNum + 1
  167.  
  168. Pictures.DemoPictureNum.Name = "Fuzzy spirals"
  169. Pictures.DemoPictureNum.X = ".15753543"
  170. Pictures.DemoPictureNum.Y = "0.63759561"
  171. Pictures.DemoPictureNum.Zooms = 23
  172. Pictures.DemoPictureNum.Type = "Mandelbrot"
  173. Pictures.DemoPictureNum.ExtraIterations = 0
  174. DemoPictureNum = DemoPictureNum + 1
  175.  
  176. Pictures.DemoPictureNum.Name = "Crossing Spirals"
  177. Pictures.DemoPictureNum.X = "-0.4658325"
  178. Pictures.DemoPictureNum.Y =  "-0.548969"
  179. Pictures.DemoPictureNum.Zooms = 21
  180. Pictures.DemoPictureNum.Type = "Mandelbrot"
  181. Pictures.DemoPictureNum.ExtraIterations = 0
  182. DemoPictureNum = DemoPictureNum + 1
  183.  
  184. Pictures.DemoPictureNum.Name = "Axis mand"
  185. Pictures.DemoPictureNum.X = "-1.941"
  186. Pictures.DemoPictureNum.Y =  "0"
  187. Pictures.DemoPictureNum.Zooms = 10
  188. Pictures.DemoPictureNum.Type = "Mandelbrot"
  189. Pictures.DemoPictureNum.ExtraIterations = 0
  190. DemoPictureNum = DemoPictureNum + 1
  191.  
  192. Pictures.DemoPictureNum.Name = "Fingers"
  193. Pictures.DemoPictureNum.X = "-1.2400805220702"
  194. Pictures.DemoPictureNum.Y =  "0.4165960742914"
  195. Pictures.DemoPictureNum.Zooms = 39
  196. Pictures.DemoPictureNum.Type = "Mandelbrot"
  197. Pictures.DemoPictureNum.ExtraIterations = 0
  198. DemoPictureNum = DemoPictureNum + 1
  199.  
  200. Pictures.DemoPictureNum.Name = "Inside Mitosis"
  201. Pictures.DemoPictureNum.X = "-0.776526256"
  202. Pictures.DemoPictureNum.Y =  "0.134646536"
  203. Pictures.DemoPictureNum.Zooms = 26
  204. Pictures.DemoPictureNum.Type = "Mandelbrot"
  205. Pictures.DemoPictureNum.ExtraIterations = 300
  206. DemoPictureNum = DemoPictureNum + 1
  207.  
  208.  
  209. Pictures.DemoPictureNum.Zooms = 0    /* This marks the end of the list. */
  210.  
  211.  
  212.  
  213. /* Parse out the command option.  This script is called when the */
  214. /* user wants demo mode started, when the user wants demo mode terminated */
  215. /* and whenever one of the demo frames is finished. */
  216.  
  217. parse arg command
  218.  
  219. command = upper(command)    /* Make sure the command is in upper case. */
  220.  
  221. if (command = START) then
  222.     CALL StartDemo()
  223. else if (command = STOP) then
  224.     CALL StopDemo()
  225. else
  226.     CALL ContinueDemo()
  227.  
  228. Exit
  229.  
  230.  
  231.  
  232. StartDemo:
  233.     DemoPictureNum = GETCLIP("DemoPictureNum")
  234.     /* Comment out the following line if you want this script to always */
  235.     /* restart at frame zero when you rerun it. */
  236.     if (DemoPictureNum = "") THEN
  237.         DO
  238.         DemoPictureNum = 0
  239.         CALL SETCLIP("DemoPictureNum", DemoPictureNum)
  240.         END
  241.     CALL NewLocation()
  242.     EVENTACTION PICTUREDONE Demo
  243.  
  244.     /* Put a command in the user menu for stopping the movie creation. */
  245.     menu '"------------------------"'
  246.     menu '"Stop Demo"' Demo stop
  247.     RETURN 0
  248.  
  249.  
  250.  
  251. StopDemo:
  252.     /* Tell Mand2000 not to call this script any more. */
  253.     EVENTACTION PICTUREDONE
  254.     /* Remove the `stop iter movie' menu. */
  255.     CLEARNMENUS 2
  256.     DISPLAYMESSAGE off
  257.     RETURN 0
  258.  
  259.  
  260.  
  261. ContinueDemo:
  262.     DemoPictureNum = GETCLIP("DemoPictureNum")
  263.     GETATTR stem PROJ
  264.     if (PROJ.NumZooms >= Pictures.DemoPictureNum.Zooms) THEN DO
  265.         DemoPictureNum = DemoPictureNum + 1
  266.         if (Pictures.DemoPictureNum.Zooms = 0) THEN    /* End of list */
  267.             DemoPictureNum = 0
  268.         CALL SETCLIP("DemoPictureNum", DemoPictureNum)
  269.         CALL NewLocation()
  270.         RETURN 0
  271.         END
  272.  
  273.     ZoomInToFloat Pictures.DemoPictureNum.X Pictures.DemoPictureNum.Y
  274.  
  275.     /* Comment out the following two lines if you only want the demo to do one zoom */
  276.     /* at a time.  Replicate the following three lines if you want the demo to do */
  277.     /* additional zooms each time. */
  278.     GETATTR stem PROJ
  279.     if (PROJ.NumZooms < Pictures.DemoPictureNum.Zooms) THEN
  280.         ZoomInToFloat Pictures.DemoPictureNum.X Pictures.DemoPictureNum.Y
  281.  
  282.     GETATTR stem PROJ
  283.     DisplayMessage 0 0 prompt "Calculating:" Pictures.DemoPictureNum.Name || "|Zoom" PROJ.NumZooms "of" Pictures.DemoPictureNum.Zooms || "|Select 'Stop Demo' to stop"
  284.     RETURN 0
  285.  
  286.  
  287.  
  288. NewLocation:
  289.     RESET
  290.     SETFRACTALTYPE Pictures.DemoPictureNum.Type
  291.     if (Pictures.DemoPictureNum.JuliaReal ~= "") THEN
  292.         SETJULIA Pictures.DemoPictureNum.JuliaReal Pictures.DemoPictureNum.JuliaImaginary
  293.     /* Remove the comments on the following line if you want the pictures */
  294.     /* name printed to the CLI when a new pictures starts calculating. */
  295.     /* say Pictures.DemoPictureNum.Name*/
  296.  
  297.     MaxIters 75 + Pictures.DemoPictureNum.ExtraIterations
  298.  
  299.     /* Comment out the following line if you don't want the status window. */
  300.     DisplayMessage 0 0 prompt "Calculating:" Pictures.DemoPictureNum.Name || "|Zoom 0 of" Pictures.DemoPictureNum.Zooms || "|Select 'Stop Demo' to stop"
  301.     RETURN 0
  302.